package wec_wallet.ebo.com.activity.main;


import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;


import java.util.ArrayList;
import java.util.List;

import bassproject.ebo.com.ebobass.activity.BaseFragment;
import wec_wallet.ebo.com.activity.FirstFragment;

/**
 * Created by Administrator on 2017/12/29.
 */

public class FragmentPageAdapter extends FragmentPagerAdapter {

    private List<BaseFragment> listfragment = new ArrayList<>(); //创建一个List<Fragment>
    private List<String> titles = new ArrayList<>();

    public FragmentPageAdapter(FragmentManager fm) {
        super(fm);
        listfragment.add(FirstFragment.newInstance());
        listfragment.add(WalletFragment.newInstance());
        listfragment.add(PriceFragment.newInstance());
        listfragment.add(MineFragment.newInstance());
    }



    @Override
    public int getCount() {
        return listfragment.size();
    }

    @Override
    public Object instantiateItem(ViewGroup vg, int position) {
        return super.instantiateItem(vg, position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        System.out.println("position Destory" + position);
        super.destroyItem(container, position, object);
    }

    @Override
    public BaseFragment getItem(int position) {

        return listfragment.get(position);

    }







    public List<BaseFragment> getList(){
        return listfragment;
    }
}
